package com.taikang.hmp.hbusiness.diabetes.measure.information.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.common.service.impl.BaseServiceImpl;
import com.taikang.hmp.hbusiness.diabetes.measure.information.service.IInformationService;

/** 
 * 公告通知
 * author:qrp
 * time:2015年12月15日 上午11:28:44
 */
public class InformationServiceImpl extends BaseServiceImpl implements IInformationService{

	public List<Dto> getHotQuestionList(Dto paramDto) {
		int pages = Integer.parseInt(paramDto.getAsString("pages"));
		int start = 0;
		int limit = 30;
		if(pages != 0){
			start = pages * 10;
		}
		
		Dto dto = new BaseDto();
		dto.put("start", start);
		dto.put("limit", limit);
		
		List<Dto> list = null;
		try {
			list = super.getNewDao().queryForPage("information_space.getHotQuestionList", dto);
		} catch (SQLException e) {
			e.printStackTrace();
		}	
		return list;
	}

	
	public Dto getHotQuestionDetail(Dto paramDto) {
		
		String id = paramDto.getAsString("id");
		
		Dto dto = null;
		List<Dto> list = null;
		try {
			list =super.getNewDao().queryForList("information_space.getHotQuestionDetail", id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		if(list.size()>0){
			dto=list.get(0);
		}
		return dto;
		
	}


	public String gethealtherInfo(String uid) {
		List<Dto> list = super.getNewDao().queryForList("information_space.gethealtherInfo", uid);
		String muid = "";
		if(list.size() > 0){
			muid = list.get(0).getAsString("friend_id");
		}
		return muid;
	}

}
